#region Developer's comment header
/* SysdiagramsSearcher.cs
 * 
 * author:    DS2171
 * copyright: DS2171
 * 
 * history:   15/11/2010 17.25.13, DS2171: Created.
 *
 */
#endregion
#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using Chili.Opf3;
using Chili.Opf3.Query;


#endregion

namespace DocManagerORM.Entità
{
	/// <summary>
	/// Searcher object for the "Sysdiagrams" persistent.
	/// </summary>
	public partial class SysdiagramsSearcher : ObjectSearcher<Sysdiagrams>
	{
		/// <summary>
		/// Creates an instance of the SysdiagramsSearcher Class.
		/// </summary>
		/// <param name="context">The ObjectContext instance associated with the searcher.</param>
		public SysdiagramsSearcher(ObjectContext context) : base(context)
		{
		}

		/// <summary>
		/// Returns all Sysdiagrams sorted by the sort argument.
		/// </summary>
		/// <param name="sort">The comma delimited list of fields composing the sort-key.</param>
		public ObjectSet<Sysdiagrams> FindAllSortedBy(string sort)
		{
			return base.FindAll("SortBy " + sort);
		}

		/// <summary>
		/// Returns Sysdiagrams filtered by key.
		/// </summary>
		/// <param name="diagramid"></param>
		public Sysdiagrams GetByPK__sysdiagrams__21B6055D(int diagramid)
		{
			// Build the query.
			string query = "DiagramID = {0}";


			// Create an object query and specify the query.
			ObjectQuery<Sysdiagrams> oQuery = new ObjectQuery<Sysdiagrams>(query, diagramid);

            return Context.GetObject<Sysdiagrams>(oQuery);
		}

		/// <summary>
		/// Returns Sysdiagrams filtered by key.
		/// </summary>
		/// <param name="principalid"></param>
		/// <param name="name"></param>
		public ObjectSet<Sysdiagrams> GetByUK_principal_name(int principalid, string name)
		{
			// Build the query.
			string query = "PrincipalID = {0}";
			query += "AND Name = {1}";


			// Create an object query and specify the query.
			ObjectQuery<Sysdiagrams> oQuery = new ObjectQuery<Sysdiagrams>(query, principalid, name);

			return Context.GetObjectSet<Sysdiagrams>(oQuery);
		}

	}
}
